package com.fourth_groups.shopping121store.ui.person.view;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.fourth_groups.shopping121store.R;

import org.greenrobot.eventbus.EventBus;

public class Nickname extends AppCompatActivity {

    private Button nick_btn;
    private EditText nick_edit;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_nickname);
       initview();
    }

    private void initview() {
        nick_btn = (Button) findViewById(R.id.nick_btn);
        nick_edit = (EditText) findViewById(R.id.nick_edit);
        nick_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String nick = nick_edit.getText().toString();
                if (nick!=null){
                    EventBus.getDefault().post(nick);
                    finish();
                    Toast.makeText(Nickname.this, "修改成功", Toast.LENGTH_SHORT).show();
                }

            }
        });
    }
}
